#!/usr/bin/env python

from matplotlib.pyplot import *
from numpy import *


def parseline(s):
    return [float(x) for x in s.split()]

def plot_soln(path):
    figure()
    fid = open(path, 'r')
    for line in fid:
        y = parseline(line)
        x = linspace(0,1,len(y))
        plot(x,y)


def plot_compare(path1, path2):
    figure()
    data1 = parseline(open(path1, 'r').readlines()[-1])
    data2 = parseline(open(path2, 'r').readlines()[-1])
    x = linspace(0,1,len(data1))
    plot(x, data1, x, data2)

    

    

p1 = 'soln_fwd_euler'
p2 = 'soln_cn'

plot_soln(p1)
plot_soln(p2)
plot_compare(p1,p2)

show()

